import math, time, turtle
t = turtle.Pen()
turtle.setup(1.0, 1.0)
turtle.bgcolor("black")
t.color("red")
t.ht()
t.pensize(4)
a = 0
temp = 0.02
while True:
    turtle.tracer(0)
    t.clear()
    pos = []
    i = -1.81
    while i <= 1.81:
        t1 = (i**2)**(1/3)
        t2 = 3.3-i**2
        y = t1 + 0.9*(t2**0.5)*math.sin(a*3.1415*i)
        pos.append([i*150 ,y*150-40])
        i += 0.01
    t.penup()
    t.goto(pos[0][0],pos[0][1])
    t.pendown()
    for coo in pos:
        t.goto(coo[0],coo[1])
    turtle.update()
    time.sleep(0.001)
    if a >= 10:
        temp = -0.02
    if a <= 8:
        temp = 0.02
    a += temp
turtle.done()